<%@ page import="org.bson.Document" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.mongodb.BasicDBObject" %>
<%@ page import="com.mongodb.client.*" %>
<%@ page import="javax.print.Doc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改学生</title>
</head>
<body>
<%
    String sno=request.getParameter("sno");
    MongoClient conn = MongoClients.create("mongodb://g08:" + URLEncoder.encode("abc@8") + "@mongo.zhledu.cn:27017/g08");
    MongoDatabase g08 = conn.getDatabase("g08");
    MongoCollection<Document> student = g08.getCollection("student");
    Document query=new Document("sno",sno);
    Document s=student.find(query).first();
%>


<center>
    <form action="doUpdate.jsp" method="post">
    <table border="1px">
        <tr>
            <td>学号</td>
            <td><input type="text" name="sno" value="<%=s.get("sno")%>" readonly></td>
        </tr>
        <tr>
            <td>姓名</td>
            <td><input type="text" name="name" id="name" value="<%=s.get("name")%>"></td>
        </tr>
        <tr>
            <td>性别</td>
            <td>
                <input type="radio" name="sex" value="男" <%="男".equals(s.get("sex"))?"checked":""%> >男
                <input type="radio" name="sex" value="女" <%="女".equals(s.get("sex"))?"checked":""%>>女
            </td>
        </tr>
        <tr>
            <td>年龄</td>
            <td><input type="number" name="age" id="age" value="<%=s.get("age")%>"></td>
        </tr>
        <tr>
            <td>身份证号</td>
            <td><input type="text" name="idCard" id="idCard" value="<%=s.get("idCard")%>"></td>
        </tr>
        <tr>
            <td>出生日期</td>
            <td><input type="date" name="birthDay" id="birthDat" value="<%=s.get("birthDay")%>"></td>
        </tr>
        <tr>
            <td>电话号码</td>
            <td><input type="tel" name="phone" id="phone" value="<%=s.get("phone")%>"></td>
        </tr>
        <tr>
            <td>专业</td>
            <td><input type="text" name="major" id="major" value="<%=s.get("major")%>"></td>
        </tr>
        <tr>
            <td>电子邮箱</td>
            <td><input type="email" name="email" id="email" value="<%=s.get("email")%>"></td>
        </tr>
        <tr>
            <td>用户名</td>
            <td><input type="text" name="username" id="username" value="<%=s.get("username")%>"></td>
        </tr>
        <tr>
            <td>密码</td>
            <td><input type="password" name="password" id="password" value="<%=s.get("password")%>"></td>
        </tr>
        <tr>
            <td>地址</td>
            <td><input type="text" name="address" id="address" value="<%=s.get("address")%>"></td>
        </tr>

        <tr>
            <td><input type="submit" value="保存"></td>
            <td><input type="reset" value="重置"></td>
        </tr>

    </table>

        <%
            conn.close();
        %>
    </form>
</center>

</body>
</html>
